package com.dili.dd.gpi.mapper;

import com.dili.dd.gpi.domain.Site;
import com.dili.dd.gpi.domain.SiteExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface SiteMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int countByExample(SiteExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int deleteByExample(SiteExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    @Delete({
        "delete from site",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    @Insert({
        "insert into site (`name`, `domain`, ",
        "description, deleted, ",
        "create_time, update_time)",
        "values (#{name,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, ",
        "#{description,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Site record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int insertSelective(Site record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    List<Site> selectByExample(SiteExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    @Select({
        "select",
        "id, `name`, `domain`, description, deleted, create_time, update_time",
        "from site",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Site selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int updateByExampleSelective(@Param("record") Site record, @Param("example") SiteExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int updateByExample(@Param("record") Site record, @Param("example") SiteExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    int updateByPrimaryKeySelective(Site record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table site
     *
     * @mbggenerated Mon Oct 19 17:05:18 CST 2015
     */
    @Update({
        "update site",
        "set `name` = #{name,jdbcType=VARCHAR},",
          "`domain` = #{domain,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "deleted = #{deleted,jdbcType=BIT},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Site record);
}